#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
#include "header.h"

int reglejeu()
{
    SDL_Event event;
    SDL_Rect  desti;
    SDL_Surface *ecran2, *image2;
    int done=1;

    atexit(SDL_Quit);

    if (SDL_Init(SDL_INIT_VIDEO) < 0)
    {
        printf( "Echec d'initialisation de SDL.\n");

    }

    printf("SDL est initialisé avec succès.\n");


    ecran2 = SDL_SetVideoMode(960, 640, 32, SDL_ANYFORMAT|SDL_FULLSCREEN);
    if ( ecran2 == NULL )
    {
        printf("Echec de creation de la fenetre\n");
    }

    else
    {
        image2 = SDL_LoadBMP("data/img/reglejeu.bmp");
    }
    if ( image2 == NULL )
    {
        printf("Echec de chargement du fichier regledujeu.bmp\n");

    }

//cordonner du bouton retour

    desti.x = 20;
    desti.y = 494.65;
    desti.w = 144;
    desti.h = 77.21;

    SDL_BlitSurface(image2, NULL, ecran2, NULL);
    SDL_UpdateRect(ecran2, 0, 0, 0, 0);
    SDL_EnableKeyRepeat(10,10);

    while(done)
    {
        while (SDL_PollEvent(&event))
        {
            switch (event.type)
            {
            case SDL_QUIT:
                done = 0;
                break;
                {
                case SDL_MOUSEBUTTONUP:
                    if (event.button.button == SDL_BUTTON_LEFT && desti.x < event.button.x && event.button.x < desti.x + 144 &&
                            desti.y < event.button.y && event.button.y < desti.y + 77.21)
                        menu1();
                    break;
                }


                while(done)
                {



                case SDL_KEYDOWN:

                    if (event.key.keysym.sym == SDLK_ESCAPE)
                        done = 0;
                    break;







                }
            }
        }
    }
}
